const baseUrl = "http://192.168.1.11:5001/wx"

const request = function(url,methods,data,header={}){
    return new Promise((resolove,reject)=>{
        // 加载Loading
        wx.showLoading({
          title: '加载中...', //提示的内容,
        });
        wx.request({
          url: baseUrl+url, //开发者服务器接口地址",
          data: data, //请求的参数",
          method: methods,
          header:{
              "content-type":"application/json"
          },
          success: res => {
            wx.hideLoading();
            resolove(res.data)
          },
          fail: (err) => {
            wx.hideLoading();
            reject(err)

          },
          complete: () => {
            wx.hideLoading();

          }
        });

    })
}

export function get(url,data){
    return request(url,'get',data)
}

export function post(url,data){
    return request(url,'post',data)
}